package leetcode.presum;

public class Lc2270 {

    public static int waysToSplitArray(int[] nums) {
        long[] preSum = new long[nums.length];
        preSum[0] = nums[0];
        for (int i = 1; i < nums.length; i++) {
            preSum[i] = preSum[i-1] + nums[i];
        }
        int n = nums.length - 1;
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (preSum[i] >= preSum[n] - preSum[i])
                cnt++;
        }
        return cnt;
    }

    public static void main(String[] args) {
        int[] arr = {2, 3, 1, 0};
        System.out.println(Lc2270.waysToSplitArray(arr));
    }



}
